-
Notifications
You must be signed in to change notification settings - Fork 7.7k
net: connection: Unconditionally forward packets when handling packet sockets #93246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* with this packet regardless the result. | ||
*/ | ||
raw_pkt_continue = true; | ||
continue; /* L2 not processed yet */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need to continue
here (skip this "connection") if the condition is satisfied? We don't want to report raw packets to datagram packet sockets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
subsys/net/ip/connection.c
Outdated
@@ -713,6 +705,11 @@ enum net_verdict net_conn_packet_input(struct net_pkt *pkt, uint16_t proto, enum | |||
|
|||
k_mutex_unlock(&conn_lock); | |||
|
|||
/* We shall continue with raw packets regardless the result. */ | |||
if (type == SOCK_RAW) { | |||
raw_pkt_continue = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, when working with packet sockets I found this raw_pkt_continue
quite fishy and I'm tempted to suggest we should just get rid of it. It seems a bit odd that packet socket, which delivers packet clones anyway, makes a decission whether the net stack should proceed with packet processing or not, it seems quite error prone (as this example shows).
Especially that with generalized L3 handling, it seems that the same issue will arise with packets delivered at the DGRA level. IMHO we should just return NET_CONTINUE
here unconditionally and let the net stack decide how to proceed with the packet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully agree.
Can we even make them return void
instead of NET_CONTINUE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API's internal so we could update the function signature too.
e69c9a8
to
c61f82f
Compare
Store the flag in the packet meta-data so that processing may be deferred if necessary. Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
Use the l2_processed-flag to decide whether a network packet needs to be processed by an L2-handler. This could be used in the future to requeue packets for later processing by a different traffic class queue. Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
Specify the socket type, when inputing a packet into a packet-socket. Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
c61f82f
to
64dc2b6
Compare
When handling packets for inputing into packet-sockets, unconditionally forward them, so that they may be handled by the rest of the network stack after. Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
64dc2b6
to
c287e48
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting -1 so that this is not merged accidentally. I am not able to do a proper review atm, but will return to this after returning from vacation.
When handling packets for inputing into raw-packet-sockets, unconditionally
forward them to upper layer, so that it can be handled by L2-handlers.
Based on: #93050
Fixes: #93245